package org.apache.jsp.WEB_002dINF.pages;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class docTest_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html lang=\"en\">\r\n");
      out.write("<head>\r\n");
      out.write("\t<script type=\"text/javascript\">\r\n");
      out.write("\t\tvar documentData = ");
out.print(request.getAttribute("documentData"));
      out.write(";\r\n");
      out.write("\t\tvar availableStatuses = ");
out.print(request.getAttribute("availableStatuses"));
      out.write(";\r\n");
      out.write("\t\tvar availableDocTypes = ");
out.print(request.getAttribute("availableDocTypes"));
      out.write(";\r\n");
      out.write("\t</script>\r\n");
      out.write("\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
      out.write("\t<title>Document</title>\r\n");
      out.write("\t<style>\r\n");
      out.write("\t\tbody {\r\n");
      out.write("\t\t\tbackground-color: AliceBlue ;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\tinput {\r\n");
      out.write("\t\t\twidth: 80%;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t.frame {\r\n");
      out.write("\t\t\tborder-style:solid;\r\n");
      out.write("\t\t\tborder-width:1px;\r\n");
      out.write("\t\t\tborder-color:LightSteelBlue;\r\n");
      out.write("\r\n");
      out.write("\t\t\tpadding: 5px;\r\n");
      out.write("\t\t\tdisplay: inline-block;\r\n");
      out.write("\t\t\t/*clear: none;*/\r\n");
      out.write("\t\t\tfloat: left;\r\n");
      out.write("\t\t\tmargin: 5px;\r\n");
      out.write("\t\t\tbackground-color: white;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t#header {\t\t\t\r\n");
      out.write("\t\t\twidth: 882px;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t#menu {\t\t\t\r\n");
      out.write("\t\t\twidth: 280px;\r\n");
      out.write("\t\t\tclear: none;\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t#info {\r\n");
      out.write("\t\t\twidth: 580px;\r\n");
      out.write("\t\t\tclear: none;\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t#container {\r\n");
      out.write("\t\t\tmin-width: 920px;\r\n");
      out.write("\t\t\twidth: 900px;\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t\tmargin-left:auto;\r\n");
      out.write("\t\t\tmargin-right:auto;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\t.bold {\r\n");
      out.write("\t\t\tfont-weight: bold;\r\n");
      out.write("\t\t}\r\n");
      out.write("\t</style>\r\n");
      out.write("\t\r\n");
      out.write("\t<script src=\"js/jquery-1.10.1.js\"></script>\r\n");
      out.write("\t\r\n");
      out.write("\t<script>\r\n");
      out.write("\t/*\r\n");
      out.write("\tfunction getInputTextField(label, name, value) {\r\n");
      out.write("\t\t//if value==null... value = \"\";\r\n");
      out.write("\t\tvar template = label + \":<br/> <input type=\\\"text\\\" name=\\\"\" +\r\n");
      out.write("\t\tname + \"\\\" + value=\\\"\" +\r\n");
      out.write("\t\tvalue + \"\\\"><br/><br/>\";\r\n");
      out.write("\t\treturn template;\r\n");
      out.write("\t}\r\n");
      out.write("\tfunction getDropdownList(label, name, options, selectedValue) {\r\n");
      out.write("\t\tvar optionsList = \"\";\r\n");
      out.write("\t\tfor(var i = 0; i < options.length; i = i + 1) {\r\n");
      out.write("\t\t\tvar selected = \"\";\r\n");
      out.write("\t\t\tif(options[i]==selectedValue) {\r\n");
      out.write("\t\t\t\tselected = \"selected\";\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\toptionsList += \"<option value=\\\"\"+ options[i] +\"\\\" \"+ selected +\">\"+ options[i] +\"</option>\";\r\n");
      out.write("\t\t}\r\n");
      out.write("\t\tvar template = label + \":<br/><select name=\\\"\" + name + \"\\\">\" +\r\n");
      out.write("\t\toptionsList +\r\n");
      out.write("\t\t\"<select><br/><br/>\";\r\n");
      out.write("\t\treturn template;\r\n");
      out.write("\t}\r\n");
      out.write("\t*/\r\n");
      out.write("\tString.format = function() {\r\n");
      out.write("\t\t  var s = arguments[0];\r\n");
      out.write("\t\t  for (var i = 0; i < arguments.length - 1; i++) {       \r\n");
      out.write("\t\t    var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\");             \r\n");
      out.write("\t\t    s = s.replace(reg, arguments[i + 1]);\r\n");
      out.write("\t\t  }\r\n");
      out.write("\t\t  return s;\r\n");
      out.write("\t}\r\n");
      out.write("\t\r\n");
      out.write("\t$(document).ready(function () {\r\n");
      out.write("\t\t\tvar template = \"\";\r\n");
      out.write("\t\t\tfor(var i = 0; i < availableStatuses.length; i = i+1) {\r\n");
      out.write("\t\t\t\ttemplate += \"<option value=\\\"\" + availableStatuses[i].value + \"\\\">\" + availableStatuses[i].text + \"</option>\";\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t\t\t$(\"#status\").append(template);\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t\t/*for every json-object*/\r\n");
      out.write("\t\t\t\r\n");
      out.write("\t\t\tfor(var i = 0; i < documentData.length; i = i+1) {\r\n");
      out.write("\t\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t/*if current json-object is a set of standard attributes, set these attributes*/\r\n");
      out.write("\t\r\n");
      out.write("\t\t\t\tif(documentData[i].dataType==\"common\") {\r\n");
      out.write("\t\t\t\t\t//set all common fields\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t$(\"#type\").text(\"tut dolzhen byt' tip dokumenta\");\r\n");
      out.write("\t\t\t\t\t$(\"#description\").attr('value', documentData[i].description);\r\n");
      out.write("\t\t\t\t\t$(\"#name\").attr('value', documentData[i].name);\r\n");
      out.write("\t\t\t\t\t$(\"#status\").children().each(function() {\r\n");
      out.write("\t\t\t\t\t    if($(this).attr(\"value\")==documentData[i].status) {\r\n");
      out.write("\t\t\t\t\t    \t$(this).attr('selected','');\r\n");
      out.write("\t\t\t\t\t    };\r\n");
      out.write("\t\t\t\t\t});\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t/*if current json-object is a single attribute, generate and append an attribute*/\t\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t} else {\r\n");
      out.write("\t\t\t\t\tvar template = \"\";\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t/*attribute is a text field*/\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\tif(documentData[i].type==\"textfield\") {\r\n");
      out.write("\t\t\t\t\t\ttemplate = \"{0}:<br/><input id=\\\"{0}\\\" type=\\\"text\\\" name=\\\"{0}\\\" value=\\\"{1}\\\"><br/><br/>\";\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\tif(documentData[i].value==null){\r\n");
      out.write("\t\t\t\t\t\t\tdocumentData[i].value = \"\";\r\n");
      out.write("\t\t\t\t\t\t}\r\n");
      out.write("\t\t\t\t\t\t$(\"#form\").append(String.format(template, documentData[i].lable, documentData[i].value));\r\n");
      out.write("\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t/*attribute is a dropdown-list*/\r\n");
      out.write("\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t} else if(documentData[i].type==\"select\") {\r\n");
      out.write("\t\t\t\t\t\ttemplate = String.format(\"{0}:<br/><select id=\\\"select{1}\\\">\", documentData[i].lable, i);\r\n");
      out.write("\t\t\t\t\t\tfor(var j = 0; j < documentData[i].values.length; j = j+1) {\r\n");
      out.write("\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\tvar option = \"<option value=\\\"{0}\\\"\";\r\n");
      out.write("\t\t\t\t\t\t\tif(documentData[i].values[j].value == documentData[i].value) {\r\n");
      out.write("\t\t\t\t\t\t\t\toption += \" selected \";\r\n");
      out.write("\t\t\t\t\t\t\t}\r\n");
      out.write("\t\t\t\t\t\t\toption += \">{1}</option>\";\r\n");
      out.write("\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\ttemplate += String.format(option, documentData[i].values[j].value, documentData[i].values[j].text);\r\n");
      out.write("\t\t\t\t\t\t}\r\n");
      out.write("\t\t\t\t\t\ttemplate += \"</select><br/><br/>\";\r\n");
      out.write("\t\t\t\t\t\t$(\"#form\").append(String.format(template, documentData[i].value));\r\n");
      out.write("\t\t\t\t\t}\t\t\t\t\t\r\n");
      out.write("\t\t\t\t}\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\t});\r\n");
      out.write("\t</script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("<div id=\"container\">\r\n");
      out.write("\r\n");
      out.write("<div id=\"header\" class=\"frame\">\r\n");
      out.write("<h1>Header</h1>\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("<div id=\"menu\" class=\"frame\">\r\n");
      out.write("<h2>Menu</h2>\r\n");
      out.write("catalog :<br/>\r\n");
      out.write("<span id=\"catalog\" class=\"bold\">Some catalog</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("<div id=\"info\" class=\"frame\">\r\n");
      out.write("<h2>Info</h2>\r\n");
      out.write("<form id=\"form\">\r\n");
      out.write("\r\n");
      out.write("type:<br/>\r\n");
      out.write("<span id=\"type\" class=\"bold\">Some document type</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("status:<br/>\r\n");
      out.write("<select id=\"status\" name=\"status\">\r\n");
      out.write("</select><br/><br/>\r\n");
      out.write("\r\n");
      out.write("name:<br/>\r\n");
      out.write("<input id=\"name\" type=\"text\" name=\"name\"><br/><br/>\r\n");
      out.write("\r\n");
      out.write("description:<br/>\r\n");
      out.write("<input id=\"description\" type=\"text\" name=\"description\"><br/><br/>\r\n");
      out.write("\r\n");
      out.write("created :<br/>\r\n");
      out.write("<span id=\"created\" class=\"bold\">11/11/1111</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("created by:<br/>\r\n");
      out.write("<span id=\"created_by\" class=\"bold\">Ivan Ivanov</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("updated :<br/>\r\n");
      out.write("<span id=\"updated\" class=\"bold\">11/11/1111</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("updated by:<br/>\r\n");
      out.write("<span id=\"updated_by\" class=\"bold\">Bazil Pupkin</span><br/><br/>\r\n");
      out.write("\r\n");
      out.write("</form> \r\n");
      out.write("</div>\r\n");
      out.write("</div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
